/**
 * 存储用户身份信息令牌
 */

export const CACHE_KEY = {
	ACCESS_TOKEN: 'access_token',
	REFRESH_TOKEN: 'refresh_token',
}

// 存储访问令牌
export const setAccessToken = (accessToken) => {
	uni.setStorageSync(CACHE_KEY.ACCESS_TOKEN, accessToken)
}

// 存储刷新令牌
export const setRefreshToken = (refreshToken) => {
	uni.setStorageSync(CACHE_KEY.REFRESH_TOKEN, refreshToken)
}

// 获取访问令牌
export const getAccessToken = () => {
	return uni.getStorageSync(CACHE_KEY.ACCESS_TOKEN)
}

// 获取刷新令牌
export const getRefreshToken = () => {
	return uni.getStorageSync(CACHE_KEY.REFRESH_TOKEN)
}

// 清理本地所有缓存
export const clearStorage = () => {
	uni.clearStorageSync()
}